/**
 * 
 */
package com.bestbuy.pojo;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * @author ThanhNgo
 * 
 */
@Entity
@Table(name = "product_detail")
public class ProductDetail {

	@Id
	@Column(name = "IDPRODUCTDETAIL")
	@GeneratedValue(generator="gen")
	@GenericGenerator(name="gen", strategy="foreign", parameters=@Parameter(name="property", value="product"))
	private Integer idproductdetail;

	@Column(name = "DETAIL")
	private String detail;

	@OneToOne
	@PrimaryKeyJoinColumn
	private Product product;
	
	@Column(name = "VIEW")
	private Integer view;
	
	@Column(name = "RATE")
	private Integer rate;

	// @OneToMany(mappedBy = "productdetail", fetch = FetchType.LAZY)
	// private Set<Product> products = new HashSet<Product>(0);
	public Integer getIdproductdetail() {
		return idproductdetail;
	}

	public void setIdproductdetail(Integer idproductdetail) {
		this.idproductdetail = idproductdetail;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	
	// public Set<Product> getProducts() {
	// return products;
	// }
	//
	// public void setProducts(Set<Product> products) {
	// this.products = products;
	// }

	// public ProductDetail(Integer idproductdetail, String detail,
	// Set<Product> products) {
	// super();
	// this.idproductdetail = idproductdetail;
	// this.detail = detail;
	// this.products = products;
	// }
	

	/**
	 * @return the product
	 */
	public Product getProduct() {
		return product;
	}

	/**
	 * @param product the product to set
	 */
	public void setProduct(Product product) {
		this.product = product;
	}

	/**
	 * @return the view
	 */
	public Integer getView() {
		return view;
	}

	/**
	 * @param view the view to set
	 */
	public void setView(Integer view) {
		this.view = view;
	}

	/**
	 * @return the rate
	 */
	public Integer getRate() {
		return rate;
	}

	/**
	 * @param rate the rate to set
	 */
	public void setRate(Integer rate) {
		this.rate = rate;
	}

	
	/**
	 * @param idproductdetail
	 * @param detail
	 * @param product
	 * @param view
	 * @param rate
	 */
	public ProductDetail(Integer idproductdetail, String detail,
			Product product, Integer view, Integer rate) {
		super();
		this.idproductdetail = idproductdetail;
		this.detail = detail;
		this.product = product;
		this.view = view;
		this.rate = rate;
	}

	public ProductDetail() {
		super();
		// TODO Auto-generated constructor stub
	}

}
